package com.liliya.servlet.pro;

import com.liliya.pojo.Pro;
import com.liliya.service.ProService;
import com.liliya.service.impl.ProServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2021/1/15 10:58
 */
@WebServlet(urlPatterns = "/pro/update")
public class ProUpdateServlet extends HttpServlet {
        ProService proService = new ProServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String pronum = req.getParameter("pronum");
        Pro pro = proService.findPro("pronum", Integer.parseInt(pronum));
        req.setAttribute("pro",pro);
        req.getRequestDispatcher("./proupdate.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
